package state;

public class GumballMachine {

    State insertQuarter;
    State ejectQuarter;
    State sold;
    State soldOut;

    int count = 0;

    State currentState;

    public GumballMachine(State insertQuarter, State ejectQuarter, State sold, State soldOut) {
        this.insertQuarter = new InsertQuarterState();
        this.ejectQuarter = new EjectQuarterState();
        this.sold = new SoldOutState();
        this.soldOut = new SoldOutState();
        if (count > 0) {
            currentState = new InsertQuarterState();
        } else {
            currentState = new SoldOutState();
        }
    }

    public void insertQuarter() {
        currentState.insertQuarter();
    }

    public void ejectQuarter() {
        currentState.ejectQuarter();
    }

    public void  turnCrank() {
        currentState.turnCrack();
        currentState.dispense();
    }


}
